package net.hn.hnms.biz.examination.controller;

import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.hn.hnms.biz.examination.domain.dto.PagingReqDTO;
import net.hn.hnms.biz.examination.domain.dto.request.UserExamReqDTO;
import net.hn.hnms.biz.examination.domain.dto.response.UserExamRespDTO;
import net.hn.hnms.biz.examination.service.UserExamService;
import net.hn.hnms.sys.common.core.domain.R;
import net.hn.hnms.sys.common.core.web.controller.BaseController;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 考试记录控制器
 * </p>
 */
@Api(tags = {"考试记录"})
@RestController
@RequestMapping("/exam/api/user/exam")
public class UserExamController extends BaseController {

    @Autowired
    private UserExamService baseService;


    /**
     * 分页查找
     *
     * @param reqDTO
     * @return
     */
    @ApiOperation(value = "分页查找")
    @RequestMapping(value = "/paging", method = {RequestMethod.POST})
    public R<IPage<UserExamRespDTO>> paging(@RequestBody PagingReqDTO<UserExamReqDTO> reqDTO) {
        //分页查询并转换
        IPage<UserExamRespDTO> page = baseService.paging(reqDTO);
        return R.ok(page);
    }


    /**
     * 分页查找
     *
     * @param reqDTO
     * @return
     */
    @ApiOperation(value = "分页查找")
    @RequestMapping(value = "/my-paging", method = {RequestMethod.POST})
    public R<IPage<UserExamRespDTO>> myPaging(@RequestBody PagingReqDTO<UserExamReqDTO> reqDTO) {
        //分页查询并转换
        IPage<UserExamRespDTO> page = baseService.myPaging(reqDTO);
        return R.ok(page);
    }

}
